﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace com.huawei.esdk.tp.professional.eSDKTPProfessionalMCUMgr
{
    using System;
    using System.Web.Services;
    using System.Diagnostics;
    using System.Web.Services.Protocols;
    using System.ComponentModel;
    using System.Xml.Serialization;
    using com.huawei.esdk.tp.professional.DataType;


    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name = "TPProfessionalMCUMgrServiceSoapBinding", Namespace = "http://smc.huawei.com/")]
    public partial class TPProfessionalMCUMgrService : System.Web.Services.Protocols.SoapHttpClientProtocol
    {

        private System.Threading.SendOrPostCallback queryMCUFutureResourceExOperationCompleted;

        private System.Threading.SendOrPostCallback queryMCUInfoExOperationCompleted;

        //private bool useDefaultCredentialsSetExplicitly;

        /// <remarks/>
        public TPProfessionalMCUMgrService()
        {
            this.Url = "https://localhost:18543/";
        }

        public TPProfessionalMCUMgrService(string url)
        {
            System.Net.ServicePointManager.CertificatePolicy = new com.huawei.esdk.tp.professional.Utils.MyCertificatePolicy();
            this.Url = url;
        }

        //public new string Url
        //{
        //    get
        //    {
        //        return base.Url;
        //    }
        //    set
        //    {
        //        if ((((this.IsLocalFileSystemWebService(base.Url) == true)
        //                    && (this.useDefaultCredentialsSetExplicitly == false))
        //                    && (this.IsLocalFileSystemWebService(value) == false)))
        //        {
        //            base.UseDefaultCredentials = false;
        //        }
        //        base.Url = value;
        //    }
        //}

        //public new bool UseDefaultCredentials
        //{
        //    get
        //    {
        //        return base.UseDefaultCredentials;
        //    }
        //    set
        //    {
        //        base.UseDefaultCredentials = value;
        //        this.useDefaultCredentialsSetExplicitly = true;
        //    }
        //}

        /// <remarks/>
        public event queryMCUFutureResourceExCompletedEventHandler queryMCUFutureResourceExCompleted;

        /// <remarks/>
        public event queryMCUInfoExCompletedEventHandler queryMCUInfoExCompleted;

        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smc.huawei.com/queryMCUFutureResourceEx", RequestNamespace = "http://smc.huawei.com/", ResponseNamespace = "http://smc.huawei.com/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        [return: System.Xml.Serialization.XmlElementAttribute("resultCode", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public int queryMCUFutureResourceEx(
            [System.Xml.Serialization.XmlElementAttribute("mcus", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] int[] mcus,
            [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] System.DateTime beginTime,
            [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, DataType = "duration")] string duration,
            [System.Xml.Serialization.XmlElementAttribute("mcuResList", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)] out MCUResourceEx[] mcuResList)
        {
            object[] results = this.Invoke("queryMCUFutureResourceEx", new object[] {
                        mcus,
                        beginTime,
                        duration});
            mcuResList = ((MCUResourceEx[])(results[1]));
            return ((int)(results[0]));
        }

        /// <remarks/>
        public void queryMCUFutureResourceExAsync(int[] mcus, System.DateTime beginTime, string duration)
        {
            this.queryMCUFutureResourceExAsync(mcus, beginTime, duration, null);
        }

        /// <remarks/>
        public void queryMCUFutureResourceExAsync(int[] mcus, System.DateTime beginTime, string duration, object userState)
        {
            if ((this.queryMCUFutureResourceExOperationCompleted == null))
            {
                this.queryMCUFutureResourceExOperationCompleted = new System.Threading.SendOrPostCallback(this.OnqueryMCUFutureResourceExOperationCompleted);
            }
            this.InvokeAsync("queryMCUFutureResourceEx", new object[] {
                        mcus,
                        beginTime,
                        duration}, this.queryMCUFutureResourceExOperationCompleted, userState);
        }

        private void OnqueryMCUFutureResourceExOperationCompleted(object arg)
        {
            if ((this.queryMCUFutureResourceExCompleted != null))
            {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.queryMCUFutureResourceExCompleted(this, new queryMCUFutureResourceExCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }

        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smc.huawei.com/queryMCUInfoEx", RequestNamespace = "http://smc.huawei.com/", ResponseNamespace = "http://smc.huawei.com/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        [return: System.Xml.Serialization.XmlElementAttribute("resultCode", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public int queryMCUInfoEx([System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] QueryConfigEx queryConfig, [System.Xml.Serialization.XmlElementAttribute("mcus", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true)] out MCUInfoEx[] mcus, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] out PagesInfoEx pageInfo)
        {
            object[] results = this.Invoke("queryMCUInfoEx", new object[] {
                        queryConfig});
            mcus = ((MCUInfoEx[])(results[1]));
            pageInfo = ((PagesInfoEx)(results[2]));
            return ((int)(results[0]));
        }

        /// <remarks/>
        public void queryMCUInfoExAsync(QueryConfigEx queryConfig)
        {
            this.queryMCUInfoExAsync(queryConfig, null);
        }

        /// <remarks/>
        public void queryMCUInfoExAsync(QueryConfigEx queryConfig, object userState)
        {
            if ((this.queryMCUInfoExOperationCompleted == null))
            {
                this.queryMCUInfoExOperationCompleted = new System.Threading.SendOrPostCallback(this.OnqueryMCUInfoExOperationCompleted);
            }
            this.InvokeAsync("queryMCUInfoEx", new object[] {
                        queryConfig}, this.queryMCUInfoExOperationCompleted, userState);
        }

        private void OnqueryMCUInfoExOperationCompleted(object arg)
        {
            if ((this.queryMCUInfoExCompleted != null))
            {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.queryMCUInfoExCompleted(this, new queryMCUInfoExCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }

        /// <remarks/>
        public new void CancelAsync(object userState)
        {
            base.CancelAsync(userState);
        }

        private bool IsLocalFileSystemWebService(string url)
        {
            if (((url == null)
                        || (url == string.Empty)))
            {
                return false;
            }
            System.Uri wsUri = new System.Uri(url);
            if (((wsUri.Port >= 1024)
                        && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0)))
            {
                return true;
            }
            return false;
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
    public delegate void queryMCUFutureResourceExCompletedEventHandler(object sender, queryMCUFutureResourceExCompletedEventArgs e);

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class queryMCUFutureResourceExCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
    {

        private object[] results;

        internal queryMCUFutureResourceExCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
            base(exception, cancelled, userState)
        {
            this.results = results;
        }

        /// <remarks/>
        public int Result
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((int)(this.results[0]));
            }
        }

        /// <remarks/>
        public MCUResourceEx[] mcuResList
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((MCUResourceEx[])(this.results[1]));
            }
        }
    }

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
    public delegate void queryMCUInfoExCompletedEventHandler(object sender, queryMCUInfoExCompletedEventArgs e);

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class queryMCUInfoExCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
    {

        private object[] results;

        internal queryMCUInfoExCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
            base(exception, cancelled, userState)
        {
            this.results = results;
        }

        /// <remarks/>
        public int Result
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((int)(this.results[0]));
            }
        }

        /// <remarks/>
        public MCUInfoEx[] mcus
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((MCUInfoEx[])(this.results[1]));
            }
        }

        /// <remarks/>
        public PagesInfoEx pageInfo
        {
            get
            {
                this.RaiseExceptionIfNecessary();
                return ((PagesInfoEx)(this.results[2]));
            }
        }
    }
}
